package cn.huq.day03

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}


object MapValuesDemo {
  def main(args: Array[String]): Unit = {
    val conf: SparkConf = new SparkConf().setAppName("MapValuesDemo").setMaster("local")
    val sc = new SparkContext(conf)

    val arr: Array[(String, Int)] = Array(("scala", 2), ("hadoop", 1), ("flink", 1), ("spark", 3))
    val rdd: RDD[(String, Int)] = sc.parallelize(arr, 3)

    val rdd2: RDD[(String, Int)] = rdd.mapValues(_ * 10)
    println(rdd2.collect().toBuffer)


  }

}
